package jvm.string;

public class TestStringBuilder_ {
    public static void main(String[] args) {
          long start=System.currentTimeMillis();
          t2(1000000);
          long end=System.currentTimeMillis();
          System.out.println("take:"+(end-start));
    }
    public static void t1(int count){//take2923

        String s="";
           for(int i=0;i<count;++i){
               s=s+i;
           }
    }
    public static void t2(int count){//1000000-> take:25
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<count;++i){
            builder.append(i);
        }
    }
    public static void t3(int count){//1000000-> take:18
        StringBuilder builder = new StringBuilder(count);
        for(int i=0;i<count;++i){
            builder.append(i);
        }
    }
}
